Micron Document
____ _ _ _ _
| _ \ ___ | |_ (_) _ __ ___ __| | (_) __ _
| |_) | / _ \ | __| | | | '_ \ / _ \ / _| | | | / _ |
| _ < | __/ | |_ | | | |_) | | __/ | (_| | | | | (_| |
|_| \_\ \___| \__| |_| | .__/ \___| \__,_| |_| \__,_|
|_|


The NomadNet German Wikipedia | Archives | Info
- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b

πŸ” Search

Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―

Math.h
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
math.h ist eine Header-Datei in der Standard C Library der Programmiersprache C. Sie wurde fΓΌr mathematische Funktionen entwickelt. Die Programmiersprache C++ benutzt die Funktionen ebenfalls, um die KompatibilitΓ€t von C zu C++ zu gewΓ€hrleisten, und deklariert sie in der Header-Datei cmath (dort ohne die Dateinamenserweiterung β€ž.hβ€œ verwendet).

Alle Funktionen, die einen Winkel einlesen oder ausgeben, arbeiten mit Radiant. Die meisten Funktionen arbeiten mit Gleitkommazahlen. Mathematische Funktionen, die mit ganzzahligen Werten (Integer) arbeiten, wie abv, labs, div oder ldiv, sind stattdessen in der Header-Datei stdlib.h vertreten.

Contents

β€’ Beispiel
β€’ Weblinks

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Funktionen bis C95

In den Normen bis einschließlich C95 waren die folgenden Funktionen deklariert.

| Name | Beschreibung | Mathematische Formulierung |
|---|---|---|
| acos | Arkuskosinus | arccos ⁑ x {\displaystyle \arccos x} |
| asin | Arkussinus | arcsin ⁑ x {\displaystyle \arcsin x} |
| atan | Arkustangens | arctan ⁑ x {\displaystyle \arctan x} |
| atan2 | β€žArkustangensβ€œ mit zwei Argumenten | atan2 ⁑ ( y , x ) {\displaystyle \operatorname {atan2} (y,x)} |
| ceil | Aufrundungsfunktion | ⌈ x βŒ‰ {\displaystyle \lceil x\rceil } |
| cos | Kosinus | cos ⁑ x {\displaystyle \cos x} |
| cosh | Kosinus hyperbolicus | cosh ⁑ x {\displaystyle \cosh x} |
| exp | Exponentialfunktion | e x {\displaystyle e^{x}} |
| fabs | Betragsfunktion | / x / {\displaystyle /x/} |
| floor | Ganzteilfunktion | ⌊ x βŒ‹ {\displaystyle \lfloor x\rfloor } |
| fmod | FΓΌhrt die Modulo -Funktion fΓΌr Gleitkommazahlen durch | x mod y {\displaystyle x{\bmod {y}}} |
| frexp | Teilt eine Gleitkommazahl in Faktor und Potenz mit der Basis 2 auf | |
| ldexp | Multipliziert den ersten Parameter mit 2 um den zweiten Parameter potenziert | x 2 y {\displaystyle x2^{y}} |
| log | Natürlicher Logarithmus | ln ⁑ x {\displaystyle \ln x} |
| log10 | Logarithmus zur Basis 10 | log 10 ⁑ x {\displaystyle \log _{10}x} |
| modf | Teilt eine Gleitkommazahl in zwei Zahlen auf, vor und nach dem Komma | |
| pow | Potenziert ersten mit dem zweiten Parameter | x y {\displaystyle x^{y}} |
| sin | Sinus | sin ⁑ x {\displaystyle \sin x} |
| sinh | Sinus hyperbolicus | sinh ⁑ x {\displaystyle \sinh x} |
| sqrt | Quadratwurzel | x {\displaystyle {\sqrt {x}}} |
| tan | Tangens | tan ⁑ x {\displaystyle \tan x} |
| tanh | Tangens hyperbolicus | tanh ⁑ x {\displaystyle \tanh x} |

C99-Funktionen

Mit der Norm C99 wurde math.h um die folgenden Funktionen erweitert.

| Name | Beschreibung | Mathematische Formulierung |
|---|---|---|
| acosh | Areakosinus hyperbolicus | arcosh ⁑ x {\displaystyle \operatorname {arcosh} x} |
| asinh | Areasinus hyperbolicus | arsinh ⁑ x {\displaystyle \operatorname {arsinh} x} |
| atanh | Areatangens hyperbolicus | artanh ⁑ x {\displaystyle \operatorname {artanh} x} |
| cbrt | Kubikwurzel | x 3 {\displaystyle {\sqrt[{3}]{x}}} |
| copysign( x , y ) | gibt den Wert von x mit dem Vorzeichen von y zurΓΌck | / x / β‹… sgn ⁑ y {\displaystyle /x/\cdot \operatorname {sgn} y} |
| erf | Fehlerfunktion | erf ⁑ x {\displaystyle \operatorname {erf} x} |
| erfc | Gibt den KomplementÀrfehler von x zurück | erfc ⁑ x {\displaystyle \operatorname {erfc} x} |
| exp2( x ) | Potenziert 2 mit dem ΓΌbergebenen Parameter | 2 x {\displaystyle 2^{x}} |
| expm1( x ) | Liefert den Wert von exp()-1 zurΓΌck | e x βˆ’ 1 {\displaystyle e^{x}-1} |
| fdim( x , y ) | Positive Differenz | max ( 0 , x βˆ’ y ) {\displaystyle \max(0,x-y)} |
| fma( x , y , z ) | Multipliziert und Addiert | x y + z {\displaystyle xy+z} |
| fmax( x , y ) | Maximum | max ( x , y ) {\displaystyle \max(x,y)} |
| fmin( x , y ) | Minimum | min ( x , y ) {\displaystyle \min(x,y)} |
| hypot( x , y ) | Hypotenuse | ( x 2 + y 2 ) {\displaystyle {\sqrt {(x^{2}+y^{2})}}} |
| ilogb | wie logb , gibt allerdings int zurΓΌck | (int)logb(x) |
| lgamma | Logarithmus der Gammafunktion | ln ⁑ / Ξ“ ( x ) / {\displaystyle \ln /\Gamma (x)/} |
| llrint | Rundungsfunktion | |
| lrint | Rundungsfunktion | |
| llround | Rundungsfunktion | |
| lround | Rundungsfunktion | |
| log1p( x ) | Natürlicher Logarithmus von 1 + x | ln ⁑ ( 1 + x ) {\displaystyle \ln(1+x)} |
| log2 | Logarithmus zur Basis 2 | lb ⁑ x {\displaystyle \operatorname {lb} x} |
| logb | Liefert den ganzzahligen Exponenten einer Gleitkommazahl als Gleitkommazahl | rint ⁑ ( log F L T _ R A D I X ⁑ / x / ) {\displaystyle \operatorname {rint} (\log _{\mathrm {FLT\_RADIX} }/x/)} |
| nan( s ) | Ein NaN erzeugen | 0 / 0 {\displaystyle 0/0} |
| nearbyint | Rundet Gleitkommazahlen zum nΓ€chsten Integer | |
| nextafter( x , y ) | Gibt die nΓ€chst darstellbare Zahl nach x (Richtung y ) zurΓΌck | |
| nexttoward( x , y ) | Wie nextafter , außer dass y als long double übergeben wird | |
| remainder( x , y ) | Rest einer Division | |
| remquo( x , y , p ) | Genauso wie remainder , speichert jedoch den Quotienten (als int ) als Ziel des Zeigers p | |
| rint | Rundet je nach Rundungsmodus zum nΓ€chsten Integer, gibt eine Gleitkommazahl zurΓΌck | |
| round | kaufmΓ€nnische Rundungsfunktion | ⌊ x + 0 , 5 βŒ‹ {\displaystyle \lfloor x+0{,}5\rfloor } |
| scalbln( x , y ) | x * FLT_RADIX y ( y ist long ) | x β‹… F L T _ R A D I X y {\displaystyle x\cdot \mathrm {FLT\_RADIX} ^{y}} |
| scalbn( x , y ) | x * FLT_RADIX y ( y ist int ) | x β‹… F L T _ R A D I X y {\displaystyle x\cdot \mathrm {FLT\_RADIX} ^{y}} |
| tgamma | Gammafunktion | Ξ“ ( x ) {\displaystyle \Gamma (x)} |
| trunc | Beschneidet eine Gleitkommazahl, d. h. rundet β€žRichtung Nullβ€œ | { ⌊ x βŒ‹ , x β‰₯ 0 ⌈ x βŒ‰ , x < 0 {\displaystyle {\begin{cases}\lfloor x\rfloor ,&x\geq 0\\\lceil x\rceil ,&x<0\end{cases}}} |

Beispiel

#include <stdio.h>
#include <math.h>
int main() {
double a = 5, b = 4;
double c = pow(a, b);
printf("%f hoch %f ist %f\n", a, b, c);
}

Weblinks

β€’ Rationale for International Standard – Programming Languages – C. (PDF, 898 kB) Abgerufen am 4. September 2011 (C99).
β€’ Beschreibung auf cplusplus.com (englisch)
β€’ Dokumentation von math.h auf dinkumware.com (Memento vom 21. Februar 2010 im Internet Archive)